package com.yu.waterstation.common.common.exception;

import lombok.Data;

@Data
public class ServiceException extends Exception {
    private int code = 400;

    public ServiceException(String msg) {
        super(msg);
    }

    public ServiceException(String msg, int code) {
        super(msg);
        this.code = code;
    }

    //*********************** user ***********************//
    public final static ServiceException CONST_user_not_exist =
            new ServiceException("用户不存在");

    public final static ServiceException CONST_user_is_forbidden =
            new ServiceException("该账号已被冻结");

    public final static ServiceException CONST_user_not_login =
            new ServiceException("用户未登录", 10001);

    public final static ServiceException CONST_user_login_expired =
            new ServiceException("用户登录已过期", 10001);

    public final static ServiceException CONST_token_is_not_validate =
            new ServiceException("token无效或已过期", 10001);

    public final static ServiceException CONST_login_failed =
            new ServiceException("账号不存在或密码错误");

    public final static ServiceException CONST_student_no_is_used =
            new ServiceException("学号已被使用");

    public final static ServiceException CONST_student_has_set_college =
            new ServiceException("用户已经设置过学校了，无法修改，请联系管理员");

    public final static ServiceException CONST_wx_login_failed =
            new ServiceException("通过微信登录失败");

    public final static ServiceException CONST_bind_wei_xin_failed =
            new ServiceException("绑定微信失败");

    public final static ServiceException CONST_student_has_address =
            new ServiceException("用户已经设置了寝室");

    public final static ServiceException CONST_has_not_set_address =
            new ServiceException("还没有设置寝室");

    public final static ServiceException CONST_student_reset_count_has_consumed =
            new ServiceException("您的重置次数已用完，请联系管理员");


    //*********************** task start ***********************//
    public final static ServiceException CONST_task_not_exist =
            new ServiceException("任务不存在");

    public final static ServiceException CONST_this_address_has_already_posted_a_task =
            new ServiceException("该地址已经发布了送水任务");

    public final static ServiceException CONST_task_not_belongs_to_this_worker =
            new ServiceException("该任务并属于你负责");

    public final static ServiceException CONST_param_receive_empty_bucket_num_value_error =
            new ServiceException("收到的空桶数不合法");

    public final static ServiceException CONST_ticket_num_not_enough =
            new ServiceException("剩余水票数不够");


    //*********************** task end ***********************//

    //********************** taskLog **********************//
    public final static ServiceException CONST_can_not_rollback_before_today_task_log =
            new ServiceException("不能撤销今天之前的记录");

    public final static ServiceException CONST_task_log_not_exist =
            new ServiceException("送水记录不存在");


    // ********************* college ************************* //
    public final static ServiceException CONST_college_not_exist =
            new ServiceException("大学不存在");
    // ********************** college end ******************** //


    //*********************** address ***********************//
    public final static ServiceException CONST_user_is_not_belong_this_address =
            new ServiceException("用户不属于该地址");

    public final static ServiceException CONST_address_not_exist =
            new ServiceException("地址不存在");


    //********************* token ***************************//
    public final static ServiceException CONST_token_is_not_belongs_to_current_user =
            new ServiceException("token不是当前用户的");


    //************************ other *************************//
    public final static ServiceException CONST_parameter_error =
            new ServiceException("参数错误");

    public final static ServiceException CONST_parameter_value_error =
            new ServiceException("参数值不合法");

    public final static ServiceException CONST_password_not_validate =
            new ServiceException("密码格式不合法");

    public final static ServiceException CONST_old_password_error =
            new ServiceException("旧密码错误");

    public final static ServiceException CONST_new_password_can_not_equals_old_password =
            new ServiceException("新密码不能和旧密码相同");

    public final static ServiceException CONST_visitor_mode_can_not_do_modify_operation =
            new ServiceException("游客模式 禁止修改操作");


    //*********************** 微信 weixin ********************//
    public final static ServiceException CONST_wx_validate_failed =
            new ServiceException("微信验证失败");
    public final static ServiceException CONST_user_not_bind_wei_xin =
            new ServiceException("用户未绑定微信");
    public final static ServiceException CONST_get_weixin_openid_failed =
            new ServiceException("获取微信openid失败");


    // ************************** system ************************ //
    public final static ServiceException CONST_verify_code_error_or_expire =
            new ServiceException("验证码错误或已失效");

    public final static ServiceException CONST_not_authorized =
            new ServiceException("权限不足", 10002);

    public final static ServiceException CONST_image_size_over_1MB =
            new ServiceException("图片大小超过1MB");

    public final static ServiceException CONST_image_upload_failed =
            new ServiceException("图片上传失败");

    // ******************* 管理员管理 **************** //
    public final static ServiceException CONST_can_not_change_role_of_super_system_admin_user =
            new ServiceException("无法修改超级管理员");

    //************ 修改密码
    public final static ServiceException CONST_password_pattern_error =
            new ServiceException("密码格式不合法");


    public final static ServiceException CONST_studentNo_has_exists =
            new ServiceException("学号已存在");

    public final static Exception CONST_phone_exists =
            new ServiceException("手机号已存在");

    public final static Exception CONST_phone_can_not_be_empty =
            new ServiceException("手机号码不能为空");

    public final static ServiceException CONST_don_not_has_permission =
            new ServiceException("没有权限");

    // ******************* AddressService ******************** //
    public final static ServiceException CONST_can_not_edit_other_college_data =
            new ServiceException("无法修改其他学校的数据");

    public final static ServiceException CONST_ticket_num_is_not_enough =
            new ServiceException("水票数量不够");

}
